<?php
/**
 * polwebgis
 * 
 * This file is part of polwebgis.
 *
 * @copyright   Copyright (c) 2012 Dominik Janisch (http://www.joanneum.at)
 * @lastmodified    $LastChangedDate: 2012-03-07 09:15:12 +0000 (Wed, 07 Mar 2012) $
 * @revision    $Revision: 160 $ 
 */

class InputHandlerGateway extends TableDataGateway
{           
        
    public function __construct()
    {
        $this->establishConnection();
    }
        
    public function __destruct(){}
    
    public function getGlobalDataTables()
    {
        $stmt = $this->database_connection_->newStatement('SELECT dt_id, dt_titel, g_name, e_name, e_abbr, t_id, t_name, dt_time, u_name as dt_user, tag_name, parent as globaltopic, tag_id FROM data_table_view where dt_verified_data=true order by dt_titel, e_name');
        $stmt->execute();
        $arr_return = array();
        while($row = $stmt->fetch(PDO::FETCH_ASSOC))
            $arr_return[] = $row;
        return $arr_return;
    }
    
    public function getDataTables($t_id)
    {
        $stmt = $this->database_connection_->newStatement('SELECT dt_id, dt_titel, g_name, e_name, e_abbr, t_name, dt_time, u_name as dt_user, tag_name, parent as globaltopic, tag_id, dt_verified_data FROM data_table_view where t_id=:t_id order by dt_titel, e_name');
        $stmt->bindValue(':t_id', $t_id);
        $stmt->execute();
        $arr_return = array();
        while($row = $stmt->fetch(PDO::FETCH_ASSOC))
            $arr_return[] = $row;
        return $arr_return;
    }
    
    public function getFeedData()
    {
        $stmt = $this->database_connection_->newStatement('SELECT dt_id, dt_titel, g_name, e_name, t_name, dt_time FROM data_table_view order by dt_time desc limit 10');
        $stmt->execute();
        $arr_return = array();
        while($row = $stmt->fetch(PDO::FETCH_ASSOC))
            $arr_return[] = $row;
        return $arr_return;
    }
}

?>
